<template>
  <el-card class="app-container">
    <c-u-r-d-table :option="option" ref="table"/>
  </el-card>
</template>

<script>
import CURDTable from '@/framework/components/table/CURDTable'
import ColumnType from '@/framework/constant/ColumnType'
import ProductStatusEnum from '@/feature/pdt/infra/constants/ProductStatusEnum'
import ProductLogApi from '@/infra/api/pdt/ProductLogApi'
import DateUtil from '@/framework/infra/util/DateUtil'

export default {
  name: 'NewVisitorReport',
  components: { CURDTable },
  data() {
    return {
      option: {
        exportOption: {
          remote: false
        },
        autoLoad: false,
        resetBtn: false,
        requestApi: ProductLogApi,
        tableHeight: window.innerHeight - 320,
        requestApiNames: {
          list: 'newVisitAndAddCartReport'
        },
        disableDefaultSearchParam: true,
        showSelection: false,
        pagination: false,
        columnSelector: false,
        columns: [
          {
            label: '日期',
            prop: 'log_date',
            searchable: true,
            type: ColumnType.DATE,
            hiddenInTable: true,
            width: 100
          }, {
            label: '店铺名称',
            prop: 'store_title',
            searchable: false,
            width: 100
          }, {
            label: '商品ID',
            prop: 'product_id',
            searchable: false,
            width: 120
          }, {
            label: '链接',
            prop: 'tb_link',
            viewAsLink: true,
            searchable: false,
            width: 100
          },
          {
            label: '选款师',
            width: 100,
            searchable: false,
            prop: 'style_selector_title'
          },
          {
            label: '货号',
            width: 80,
            required: true,
            prop: 'item_no'
          },
          {
            label: '商品状态',
            width: 90,
            prop: 'product_status',
            type: ColumnType.RADIO,
            options: ProductStatusEnum
          },
          {
            label: '刷单量',
            width: 90,
            prop: 'total_click_farming_sale_num',
            required: true,
            type: ColumnType.NUMBER
          },
          {
            label: '真实访客数',
            width: 100,
            prop: 'total_real_visitor_num'
          },
          {
            label: '真实收藏人数',
            width: 110,
            prop: 'total_real_collected_man_num',
            required: true,
            type: ColumnType.NUMBER
          },
          {
            label: '真实加购人数',
            type: ColumnType.NUMBER,
            width: 120,
            prop: 'total_real_carted_man_num'
          },
          {
            label: '真实销量',
            width: 140,
            type: ColumnType.NUMBER,
            prop: 'total_real_sale_num'
          }
        ]
      }
    }
  },
  mounted() {
    this.$refs.table.setFilterParam('log_date', DateUtil.currentDate()).reloadTable()
  },
  methods: {}
}
</script>

<style scoped>
.data-table {
  padding-bottom: 100px;
  overflow-x: auto;
  table-layout: fixed;
  white-space: nowrap;
}
</style>
